#include <stdio.h>
#include <math.h>
float InvSqrt(float x, int n){
	float xhalf = 0.5f*x;
	int i = *(int*)&x;
	i = 0x5f3759df - (i>>1);
	x = *(float*)&i;
	while(n--){
		x = x*(1.5f-xhalf*x*x);
	}
	return x;
}
int main(int argc, char** argv){
	float st = 9;
	int n = 4;
	printf("%f\n", InvSqrt(st, n));
	printf("%f", (float)(1/sqrt(st)));
	return 0;
}
